In this demo,
you will learn how to import and use the layout component in the react app. Different categories have different
material components listed for different purposes on
the material website. You can use these components by
importing them from packages. The website has options for navigation, surface components,
feedback components and layout components. Layout components are the foundation for
interactive experiences. Layout components are the building
blocks composed of elements and components that share similar functions. Some pre designed components
are available in layouts, which can be used to display
the layout of an app. For example, consider Box, Box is a base
component that takes sx as a prop. The sx props except style attributes
that can be added to the box component by using the sx props. You can create your custom functional
component similarly to achieve responsiveness. A grid component can be used. The grid component divides your display
screen into 12 equally sized grids. The grid component helps
to align a wrapped item or a component in the desired
direction basis. You can create a responsive
app using the grid, go back to the code,
open the layout dot jsx file. The file has some import commands for
some basic components from a material package such as box,
grid and paper. There are sx props inbox which
takes style attributes as value and try to customize your app. The grid component creates responsiveness
by adopting different sizes. The grid component can be used as
a container with various directions and aligning props to create a responsive UI. Now import the file in
the app dot Js file. You can import the layout
from components or layout and declare into the return
section of the app method. You can pass some child
components into the layout, observe the output of the code. You have provided background color and
height property for a box, so you can see that in the output. The background color is blue for
the provided height, change some properties in
the layout components. For example, set height as 50 VH and
background color as primary dark. Save and execute the file. You can observe the altering
of the height and the output. Now explore some examples
of grid components. The grid component has a prop called
a container that contains different items in it. A grid component can be passed as an item. Grid as container can have different
props to align your item component in a different orientation, such as
direct justify, content and align items. You can also assign the row spacing and
column spacing for the grid. In grid item excess means extra small,
insert values for attributes as two grids for excess. Four grids for SM or smaller screen. Four grids for MD or medium screen and
six grids for LG or large screen. Save the file and observe the output. Here you can see that four new
items have been added to the app. Open the developer tool and switch to different screen sizes
to verify the responsiveness. You can see the orientation and
alignment of the grid being altered. For the mobile view, the display size of
your grid item component gets decreased. This way you can use various
pre built layout components. Thank you.